package com.zl.personal.api.controller;

import com.zl.personal.api.domains.entity.Test;
import com.zl.personal.api.service.inters.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by zhonglin on 2017/4/7.
 */
@RestController
@RequestMapping("/api/test")
@Scope("request")
public class TestController {

    @Autowired
    private ITestService testService;

    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseStatus(HttpStatus.OK)
    public ResponseEntity<List<Test>> list() {
        return new ResponseEntity<>(testService.findAll(), HttpStatus.OK);
    }


}
